import { createRouter, createWebHistory } from 'vue-router'
import Index from '@/views/Index.vue'
import Home from '@/views/Home.vue'
import HomeIndex from '@/components/home/Index.vue'
import HomeBaseComponent from '@/components/home/BaseComponent.vue'


const routes = [
  {
    path: '/',
    name: 'index',
    component: Index
  },
  {
    path: '/home',
    component: Home,
    meta: {
      text: '首页'
    },
    children: [
      {
        path: '',
        name: 'home',
        component: HomeIndex,
        meta: {
          text: '首页'
        }
      },
      {
        path: 'basecomponent',
        name: 'home-basecomponent',
        component: HomeBaseComponent,
        meta: {
          text: '基础组件'
        },
      }
    ]
  }
]

const router = createRouter({
  routes,
  history: createWebHistory(),
  scrollBehavior() {
    return { top: 0 }
  }
})

export default router
